use eframe::egui::{self};

pub struct TopMenu {}

impl Default for TopMenu {
    fn default() -> Self {
        let top_menu = TopMenu::new();
        top_menu
    }
}

impl TopMenu {
    pub fn new() -> Self {
        Self {}
    }

    pub fn show(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) {
        
            egui::menu::bar(ui, |ui| {
                ui.menu_button("文件(F)", |ui| {
                    if ui.button("文件").clicked() {
                        // Handle "Open" action
                    }
                    if ui.button("Save").clicked() {
                        // Handle "Save" action
                    }
                    if ui.button("Exit").clicked() {
                        // Handle "Exit" action
                    }
                });
                ui.menu_button("查看", |ui| {
                    if ui.button("Undo").clicked() {
                        // Handle "Undo" action
                    }
                    if ui.button("Redo").clicked() {
                        // Handle "Redo" action
                    }
                });
                ui.menu_button("图标(C)", |ui| {
                    if ui.button("Undo").clicked() {
                        // Handle "Undo" action
                    }
                    if ui.button("Redo").clicked() {
                        // Handle "Redo" action
                    }
                });
                ui.menu_button("工具(T)", |ui| {
                    if ui.button("Undo").clicked() {
                        // Handle "Undo" action
                    }
                    if ui.button("Redo").clicked() {
                        // Handle "Redo" action
                    }
                });
                ui.menu_button("窗口(W)", |ui| {
                    if ui.button("Undo").clicked() {
                        // Handle "Undo" action
                    }
                    if ui.button("Redo").clicked() {
                        // Handle "Redo" action
                    }
                });
                ui.menu_button("帮助(H)", |ui| {
                    if ui.button("About").clicked() {
                        // Handle "About" action
                    }
                });
            
        });
    }
}
